<?php
function Spider_Gfan_Get_ForumThreadList($url){
	$plink='#<em>\[<a href="forum.php?mod=forumdisplay&fid=([\d]+)&amp;filter=typeid&amp;typeid=([\d]+)">(.*)</a>\]</em> <a href="android-([\d]*)-1-1.html" onclick="atarget(this)" class="xst" >(.*)</a>#isU';
	preg_match_all($plink);
}

function Spider_Gfan_Get_ForumList(){
$s=file_get_contents('http://bbs.gfan.com/forum.php');

$plink='#<dt><a href="forum-([\d]+)-1.html" style=\'color:.*\'>(.*)</a>#isU';

preg_match_all($plink,$s,$e);

foreach($e[1] as $k=>$id){
	$bbs[$k]['fromForumURL']='http://bbs.gfan.com/forum-'.$id.'-1.html';
	$bbs[$k]['fromForumId']=$id;
}
foreach($e[2] as $k=>$name){
	$bbs[$k]['fromForumName']=$name;
	$bbs[$k]['fromBBS']='Gfan';
	if(strpos($name,'平板')){
		$bbs[$k]['fromBBSGroup']='Android平板电脑';
	}else{
		$bbs[$k]['fromBBSGroup']='Android手机';
	}
}

foreach($bbs as $b){
        $query = makeInsertSQL('spider_forum_list', $b);
        file_put_contents(dirname(__FILE__) . '/Spider-Forum-List.sql', $query . PHP_EOL, 8);
}
}
?>